package elijah.base.adapter;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewbinding.ViewBinding;

import elijah.base.binding.DataBinding;


public abstract class BaseHolder<T, V extends ViewBinding> extends RecyclerView.ViewHolder {
    private final V binding;
    private final DataBinding<T, V> dataBinding;

    public BaseHolder(@NonNull V binding, T entity) {
        super(binding.getRoot());
        this.binding = binding;

        dataBinding = new DataBinding<T, V>(binding, entity) {
        };

    }


    public V getBinding() {
        return binding;
    }

    public DataBinding<T, V> getDataBinding() {
        return dataBinding;
    }

    public Context getContext() {
        return binding.getRoot().getContext();
    }
}
